<template>
  <div>
    <van-address-edit
      :areaList="areaList"
      :showPostal="true"
      :showSetDefault="true"
      :showSearchResult="true"
      :searchResult="searchResult"
      @save="onSave"
      @delete="onDelete"
      @change-detail="onChangeDetail"
    />
  </div>

</template>

<script>
import {AddressEdit} from 'vant';
// import areaList from '@/asstes/area.json'
export default {
  components: {
    [AddressEdit.name]: AddressEdit,
  },
  methods:{
    onSave() {
      Toast('save');
    },
    onDelete() {
      Toast('delete');
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [{
          name: '黄龙万科中心',
          address: '杭州市西湖区'
        }];
      } else {
        this.searchResult = [];
      }
    }
  },
  data(){
    return{
      areaList:require('../../assets/area.json'),
      searchResult: []
    }
  }
};
</script>

<style lang="less">

</style>
